package com.cloud.base.thread.atomic;

import java.util.concurrent.atomic.AtomicInteger;

public class AtomicMain {
    public static void main(String[] args) {
        // AtomicInteger 是线程安全的 ，可以用作cas操作
        AtomicInteger integer = new AtomicInteger(1);
        System.out.println(integer.incrementAndGet());;
        integer.compareAndSet(2,10);
        System.out.println(integer.get());
    }
}
